<?php include("../../include/inc_asegurar.php"); ?>
<?php

	// require_once ("../../include/inc_config.php");
	require_once ("../../include/inc_recibir_variables.php");
	// require_once ("../../include/inc_guardar_variables.php");
	require_once ("../../include/inc_conexion.php");
	$conn = conectarse(); 
	
	// $is_art_descripcion = "";
	// $is_art_descripcion = "a";
    $is_buscar = strtolower($term);
	
	
$return = array();
    $query = mysql_query("select art_codigo, art_descripcion, art_precio_venta from articulos where art_descripcion like '%".$is_buscar."%'");
    while ($row = mysql_fetch_array($query)) {
    array_push($return,array('art_codigo'=>$row['art_codigo'],'label'=>$row['art_descripcion'],'value'=>$row['art_descripcion'],'art_precio_venta'=>$row['art_precio_venta']));
}
echo(json_encode($return));
/* 
	// echo "select art_descripcion from articulos where art_descripcion like '%".$is_buscar."%'";
    $query = mysql_query("select art_descripcion from articulos where art_descripcion like '%".$is_buscar."%'",$conn);
    // while ($row = mysql_fetch_array($query)) {
    while ($row = mysql_fetch_assoc($query)) {
	// print_r($row);
		echo json_encode($row);
	} */
	
	/* 
	$conn = mysql_connect("localhost", "USERNAME", "PASSWORD");
    mysql_select_db("DATABASE", $conn);
	
    $q = strtolower($_GET["birds"]);

    $query = mysql_query("select FIELD from TABLE where FIELD like '%$q%'");
    while ($row = mysql_fetch_array($query)) {
    echo json_encode($row);
	 */
?>
